//
//  nextsecondHandViewController.m
//  OneCreditTreasure
//
//  Created by iOS Grouper on 16/8/29.
//
//

#import "nextsecondHandViewController.h"
#import "HeadSelectCellTableViewCell.h"
#import "DownPaymentView.h"
#import "YHYcommenTableViewCell.h"
@interface nextsecondHandViewController ()<UITableViewDelegate,UITableViewDataSource>{
    UITableView *myTableView;
    NSMutableArray *titleArray;
}
@property (nonatomic,strong)DownPaymentView *payView;
@end

@implementation nextsecondHandViewController

- (void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"二手车贷款";
    titleArray = [NSMutableArray arrayWithObjects:@"贷款额度(元)",@"保证金",@"还款方式",@"月供(元)",@"月利率",@"总利息(元)", nil];
    [self creatView];
    
}


- (void)creatView{
    myTableView = [UITableView new];
    myTableView.backgroundColor = LV;
    [self.view addSubview:myTableView];
    [myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view);
        make.left.mas_equalTo(self.view);
        make.width.mas_equalTo(kScreenW);
        make.height.mas_equalTo(kScreenH);
        
    }];
    myTableView.delegate = self;
    myTableView.dataSource = self;
    [myTableView registerClass:[HeadSelectCellTableViewCell class] forCellReuseIdentifier:@"HeadSelectCellTableViewCell"];
    [myTableView registerClass:[YHYcommenTableViewCell class] forCellReuseIdentifier:@"YHYcommenTableViewCell"];

    myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [myTableView reloadData];
    
}





- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
    else{
        return titleArray.count;
    }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
    
    HeadSelectCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HeadSelectCellTableViewCell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
     return cell;
    }
    else {
        YHYcommenTableViewCell *yhyCell = [tableView dequeueReusableCellWithIdentifier:@"YHYcommenTableViewCell"];
        yhyCell.leftTitleL.text = titleArray[indexPath.row];
        
        return yhyCell;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        return 320 * AUTO_HEIGHT;
    }
    else{
        return myTableView.rowHeight;
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
